const loaderUtils = require('loader-utils');
let mime = require('mime');

function urlLoader(source){
  // console.log(Object.keys(this));
  let {limit} = loaderUtils.getOptions(this);
  if(limit && limit > source.length){
    return `module.exports = "data:${mime.getType(this.resourcePath)};base64,${source.toString('base64')}"`
  }else{
    // file-loader
  }
  return source;
}
urlLoader.raw = true; // 二进制buffer
module.exports = urlLoader;